package com.wbl.gulimall.member;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.ConfigurableEnvironment;

/**
 * Author: 王博纶
 * Date: 2024/5/30 12:27
 * FileName: MemberApplication
 * Description: 谷粒商城 会员 模块启动类
 * ****************************************************************************************************
 * 使用fein的步骤
 * 1.导入openfeign和loadbalance的依赖
 * 2.先在启动类开启feign的调用,同时指定feign的包路径使其能扫描到
 * 3.在feign包下面创建对应的interface接口
 * 4.在feign接口中使用restController的风格来声明要调用的别的服务的接口
 * 5.在feign接口申明的发放上使用controller对应的注解,方法名,参数和controller注解保持和被调用的接口一致
 * 6.在自己的服务的controller调用feign包中的interface接口
 */
@EnableFeignClients(basePackages = "com.wbl.gulimall.member.feign") // 开启feign的远程调用
@ComponentScan("com.wbl.gulimall")
@SpringBootApplication
public class MemberApplication {
    private static final Logger Log = LoggerFactory.getLogger(MemberApplication.class);

    public static void main(String[] args) {
        SpringApplication member = new SpringApplication(MemberApplication.class);
        ConfigurableEnvironment environment = member.run(args).getEnvironment();
        Log.info("启动成功！！");
        Log.info("网关地址：\thttp://127.0.0.1:{}",environment.getProperty("server.port"));
    }
}